﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Cms.Domain
{
    public class RssFeed : IAuditable
    {
        private IList<Category> _categories;
        private IList<UserGroup> _requiredUserGroups;

        public virtual int ID { get; set; }

        public virtual string Name { get; set; }

        public virtual string Description { get; set; }

        public virtual string Filename { get; set; }

        public virtual Site Site { get; set; }

        public virtual Page ContentDisplayPage { get; set; }

        public virtual RssFeedContentDisplayMode ContentDisplayMode { get; set; }

        public virtual bool RemoveImgTags { get; set; }

        public virtual ContentSortMode SortMode { get; set; }

        public virtual IList<Category> Categories
        {
            get { return _categories; }
            set { _categories = value; }
        }

        public virtual IList<UserGroup> RequiredUserGroups
        {
            get { return _requiredUserGroups; }
            set { _requiredUserGroups = value; }
        }

        public RssFeed()
        {
            _categories = new List<Category>();
            _requiredUserGroups = new List<UserGroup>();
        }

        public virtual string GetState()
        {
            return "Name = " + Name +
                   ", Filename = " + Filename +
                   ", Categories = " + string.Join(", ", from c in _categories select c.Name) +
                   ", RequiredUserGroups = " + string.Join(", ", from g in _requiredUserGroups select g.Name);
        }
    }
}
